<?php 
/***
	Jdate.1.0.php
	name:xiaojia
	email:iatt@qq.com
	qq:273142650
	time:2011.9.22 16:35
***/
	class Jdate
	{
		function datediff ($b, $e, $p = 's') {
			$diff = strtotime($b) - strtotime($e);
			switch ($p) {
				case 'y':
					$diff = bcdiv($diff, 60 * 60 * 24 * 365);
					break;
				case 'm':
					$diff = bcdiv($diff, 60 * 60 * 24 * 30);
					break;
				case 'd':
					$diff = bcdiv($diff, 60 * 60 * 24);
					break;
				case 'h':
					$diff = bcdiv($diff, 60 * 60);
					break;
				case 'n':
					$diff = bcdiv($diff, 60);
					break;
				case 's':
					break;
			}
			return $diff;
			
		}
	}
?>